package org.ucas.faker.web.Config;

import org.ucas.faker.web.service.Visualization.entity.SeriesParam;
import org.ucas.faker.web.service.Visualization.entity.Symbol;

import java.util.ArrayList;
import java.util.List;

public class VisualConfig {

    public static class Json {

        public static class Value {
            public static final String CONSTRAINT_TYPE_EQUAL = "equal";
            public static final String CONSTRAINT_TYPE_TOPSUM = "topsum";

            public static final String RANGE_TYPE_INTERVAL = "interval";
            public static final String RANGE_TYPE_SET = "set";
            public static final String RANGE_TYPE_HYPERSET = "hyperset";
            public static final String RANGE_TYPE_TOP = "top";
            public static final String RANGE_TYPE_AUTO = "auto";

            public static final String BASIS_ORDER_ASC = "asc";
            public static final String BASIS_ORDER_DESC = "desc";
            public static final String BASIS_ORDER_T_ASC = "tasc";
            public static final String BASIS_ORDER_T_DESC = "tdesc";
        }
    }

    public static final String TYPE_BAR = "bar";
    public static final String TYPE_LINE = "line";
    public static final String TYPE_PIE = "pie";
    public static final String TYPE_STACKBAR = "stackbar";
    public static final String TYPE_STACKBARRATIO = "stackbarratio";
    public static final String TYPE_BUBBLE = "bubble";
    public static final String TYPE_STACKLINE = "stackline";
    public static final String TYPE_MAP = "map";
    public static final String TYPE_STRIPE = "stripe";
    public static final String TYPE_STACKSTRIPE = "stackstripe";
    public static final String TYPE_STACKSTRIPERATIO = "stackstriperatio";
    public static final String TYPE_STACKLINERATIO = "stacklineratio";
    public static final String TYPE_2TARGET = "2target";

    public static final String[] TYPESET_2D = {TYPE_BAR, TYPE_STRIPE, TYPE_LINE, TYPE_PIE};
    public static final String[] TYPESET_3D = {TYPE_BAR, TYPE_STRIPE, TYPE_LINE, TYPE_STACKBAR, TYPE_STACKSTRIPE,
            TYPE_STACKLINE, TYPE_STACKBARRATIO, TYPE_STACKSTRIPERATIO, TYPE_STACKLINERATIO, TYPE_BUBBLE};
    public static final String[] TYPESET_MultiTarget = {TYPE_2TARGET};

    public static String getTypeCN(String typeName){
        switch (typeName){
            case TYPE_BAR:              return "柱状图";
            case TYPE_LINE:             return "折线图";
            case TYPE_PIE:              return "饼图";
            case TYPE_STACKBAR:         return "堆叠柱状图";
            case TYPE_STACKLINE:        return "堆叠面积图";
            case TYPE_BUBBLE:           return "气泡图";
            case TYPE_MAP:              return "地图";
            case TYPE_STRIPE:           return "条形图";
            case TYPE_STACKSTRIPE:      return "堆叠条形图";
            case TYPE_STACKSTRIPERATIO: return "百分比条形图";
            case TYPE_STACKBARRATIO:    return "百分比柱状图";
            case TYPE_STACKLINERATIO:   return "百分比面积图";
            case TYPE_2TARGET:          return "序列点图";
            default:
                return "未知类型图";
        }
    }

    public static String getTargetDBKey(String key){
        switch (key){
            case "patent_count":    return "patent.id";
            case "applicant_count": return "ap_count";
            default: return key;
        }
    }

    public static Symbol getSymbol(int n){
        List<Symbol> symbolList = getSymbolList();
        int size = symbolList.size();
        return symbolList.get(n % size);
    }

    public static List<Symbol> getSymbolList(){
        List<Symbol> symbolList = new ArrayList<Symbol>();
        Symbol symbol2 = new Symbol();
        symbol2.setSymbol("circle");
        symbol2.setSymbolSize(10);
        symbolList.add(symbol2);

        Symbol symbol1 = new Symbol();
        symbol1.setSymbol("rect");
        symbol1.setSymbolSize(10);
        symbolList.add(symbol1);

        Symbol symbol4 = new Symbol();
        symbol4.setSymbol("triangle");
        symbol4.setSymbolSize(10);
        symbolList.add(symbol4);

        Symbol symbol3 = new Symbol();
        symbol3.setSymbol("diamond");
        symbol3.setSymbolSize(10);
        symbolList.add(symbol3);

        Symbol symbol8 = new Symbol();
        symbol8.setSymbol("invertedTriangle");
        symbol8.setSymbolSize(10);
        symbolList.add(symbol8);

        Symbol symbol9 = new Symbol();
        symbol9.setSymbol("roundRect");
        symbol9.setSymbolSize(10);
        symbolList.add(symbol9);

        Symbol symbol7 = new Symbol();
        symbol7.setSymbol("emptyCircle");
        symbol7.setSymbolSize(10);
        symbolList.add(symbol7);

        Symbol symbol6 = new Symbol();
        symbol6.setSymbol("emptyRect");
        symbol6.setSymbolSize(10);
        symbolList.add(symbol6);

        Symbol symbol5 = new Symbol();
        symbol5.setSymbol("emptyTriangle");
        symbol5.setSymbolSize(10);
        symbolList.add(symbol5);

        Symbol symbol10 = new Symbol();
        symbol10.setSymbol("emptyDiamond");
        symbol10.setSymbolSize(10);
        symbolList.add(symbol10);

        Symbol symbol11 = new Symbol();
        symbol11.setSymbol("emptyInvertedTriangle");
        symbol11.setSymbolSize(10);
        symbolList.add(symbol11);

        Symbol symbol12 = new Symbol();
        symbol12.setSymbol("emptyRoundRect");
        symbol12.setSymbolSize(10);
        symbolList.add(symbol12);


        return  symbolList;
    }

}
